!function (t) {
    function i(s) {
        if (e[s]) return e[s].exports;
        var n = e[s] = {
            exports: {},
            id: s,
            loaded: !1
        };
        return t[s].call(n.exports, n, n.exports, i), n.loaded = !0, n.exports
    }
    var e = {};
    return i.m = t, i.c = e, i.p = "./", i(0)
}([function (t, i, e) {
    e(1)
},  function (t, i) {
    Vue.component("pop-organization-weixin-component", {
        template:'<div class="pop-panel" v-bind:class="{\'show\':this.show}"><div class="pop-box"><div class="pop-title">{{title}}<a class="win_close_btn" @click="close()"><i class="fa fa-fw fa-close"></i></a></div><div class="pop-content"><validator name="validatorMethod"><form role="form"><div class="box-body"><div class="form-group"><label for="title">公众号名称</label><input type="text" id="name" v-model="organizationSetting.name" @invalid="nameInvalid" detect-change="off" detect-blur="off" initial="off" v-validate:name="[\'required\']" v-bind:value="organizationSetting.name" class="form-control"></div><div class="form-group"><label for="color">微信AppID</label><input type="text" id="wx_appid" @invalid="wxAppidInvalid" detect-change="off" detect-blur="off" initial="off" v-model="organizationSetting.wx_appid" class="form-control" v-bind:value="organizationSetting.wx_appid" v-validate:wx_appid="[\'required\']"></div><div class="form-group"><label for="title">微信Secret</label><input type="text" id="wx_secret" v-model="organizationSetting.wx_secret" @invalid="wxSecretInvalid" detect-change="off" detect-blur="off" initial="off" v-validate:wx_secret="[\'required\']" v-bind:value="organizationSetting.wx_secret" class="form-control"></div></div><div class="box-footer"><button type="button" class="btn btn-info btn-sm" style="width:120px;float:left;" @click="save()">保存</button><button type="button" class="btn  btn-default btn-sm" style="width:120px;float:left;margin-left:15px;" @click="close()">取消</button></div></form></validator></div></div><div class="bg"></div></div>',
        data: function () {
            return {
                show: !1,
                title:'提示窗口',
                showError:null,
                organizationSetting: {
                    id:0,
                    organization_id:0,
                    name:'',
                    wx_appid:'',
                    wx_secret:'',
                    qrcode_back:'',
                    back_x:'',
                    back_y:'',
                    qrcode_size:'',
                    state:1
                }
            }
        },
        events: {
            openOrganizationWeiXinWin: function (t) {
                var i = this;
                i.data_init(t);
            }
        },
        methods: {
            data_init: function (t) {
                this.title = t.title, this.organizationSetting = t.organizationSetting, this.showError = [], this.show = !0;
            },
            nameInvalid:function () {
                var t = this;
                t.showError.push("公众号名称不能为空");
            },
            wxAppidInvalid:function () {
                var t = this;
                t.showError.push("微信AppID不能为空");
            },
            wxSecretInvalid:function() {
                var t = this;
                t.showError.push("微信Secret不能为空");
            },
            save: function() {
                var t = this;
                t.$validate(true,function () {
                    if(!t.$validatorMethod.invalid) {
                        var index = layer.load(0, {shade:[0.3, '#000000']}); //0代表加载的风格，支持0-2
                        postMsg(root+"/organizationSetting/addoreditdata", t.organizationSetting, function(i) {
                            layer.close(index);
                            layer.alert(i.msg);
                            if (i.code == 0) {
                                t.show = !1;
                                if (t.organizationSetting.id == 0) {
                                    t.$dispatch("refreshOrganizationSettingList");
                                } else {
                                    t.$dispatch("refreshOrganizationSettingInfo", {organizationSetting:i.organizationSetting});
                                }
                            }
                        });
                    } else {
                        layer.alert(t.showError[(t.showError.length-1)], {end:function () {
                            t.showError = [];
                        }});
                    }
                });
            },
            close: function () {
                var t = this;
                t.show = !1;
            }
        }
    })
}]);